

Ext.define('UDZ.controller.Ctr_Address_Add', {
    extend: 'Ext.app.Controller',

    config: {
        refs: {
            addressAddview:{
                selector:'addressAdd',
                xtype:'addressAdd',
                autoCreate:true
            },
            AddrssAddBack:'#add_address_back',//返回收货地址管理

        },
        control:{
            AddrssAddBack:{
                tap:'func_AddressAddBack'
            }

        },
        routes:{ //自己的路由
            'route_address_add':'showAddressAdd',
            // 'route/:AddressId':''
        }
    },
    showAddressAdd:function (){
       Ext.Viewport.setActiveItem(this.getAddressAddview());

        var addresschange = Ext.getStore('Store_Address');
        addresschange.load({
            callback: function (records, operation, success) {
                if (success) {
                    var tplAddressChange = new Ext.XTemplate(
                        '<tpl for=".">'+
                        '<div class="address_container" > ' +
                        '<div class="address_content"> ' +
                        '<div class="address_name"> ' +
                        '<span class="address_span_name">{UserName}</span> ' +
                        '<span class="address_span_Tel">{UserTel}</span> ' +
                        '</div> ' +
                        '<div class="address_detail">{address}</div> ' +
                        '</div> ' +
                        '<div class="address_righrt"><img src=" resources/images/right.png" alt=""></div>'+
                        '<div>'+
                        '</tpl>'
                    )
                    var addressList = Ext.getCmp('address-add');
                    addressList.setItemTpl(tplAddressChange);
                    addressList.setStore(this);
                }
            }
        })

    },
    func_AddressAddBack:function () {
        this.redirectTo('route_address_manger');
    },
    // func_AddAddress:function () {
    //     var me=this;
    //     Ext.getCmp('add_address').element.on({
    //         tap : function( ) { //点击事件
    //             me.redirectTo('route_address_add');
    //         }
    //     });
    // }
});